#include <stdint.h>

#define UART_BASE 0x10000000
#define UART_THR 0x00
#define UART_LSR 0x05
#define UART_LSR_THRE 0x20

static inline void uart_putc(char c) {
    volatile uint8_t *thr = (uint8_t *)(UART_BASE + UART_THR);
    volatile uint8_t *lsr = (uint8_t *)(UART_BASE + UART_LSR);

    while ((*lsr & UART_LSR_THRE) == 0) ;
    *thr = c;
}

void uart_puts(const char *s) {
    while (*s) {
        uart_putc(*s++);
    }
}
